<script type="text/javascript">
		$(function(){
    var canvas = document.getElementById('canvas');
	var canvas2 = document.getElementById('canvas2');
	
    var context = canvas.getContext("2d");
	var context2 = canvas2.getContext("2d");
	var img=new Image;
	
	img.src="<?php echo Yii::app ()->request->baseUrl.'/images/404.jpg'?>";

	$(img).load(function(){
		context.drawImage(img,0,0);
		//将图像输出为base64压缩的字符串  默认为image/png  
		var data = canvas.toDataURL();  
		                    
		//删除字符串前的提示信息 "data:image/png;base64,"  
		//var b64 = data.substring( 22 );
		
		var img2=new Image;
		img2.src=data;
		$(img2).load(function(){
		context2.drawImage(img2,0,0);
		});
	});
});
	</script>
<div >
	<canvas id="canvas" width="400" height="300"></canvas>
	<canvas id="canvas2" width="400" height="300"></canvas>
</div>